import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.File;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;

public class CFileTransferable
    implements Transferable
{

    /** Supported data flavor */
    DataFlavor[] dataFlavors = { DataFlavor.javaFileListFlavor };

    /** Instances of the File classes to be transferred */
    List files = new LinkedList();

    public DataFlavor[] getTransferDataFlavors()
    {
        return dataFlavors;
    }

    public boolean isDataFlavorSupported( DataFlavor flavor )
    {
        return dataFlavors[0].equals( flavor );
    }

    public Object getTransferData( DataFlavor flavor )
        throws UnsupportedFlavorException, IOException
    {
        return files;
    }

    /**
     * Adds a file for the transfer.
     * 
     * @param f
     */
    public void addFile( File f )
    {
        files.add( f );
    }
}